package com.shanghaionstar.activity.webview.handler;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.TextView;

import com.shanghaionstar.R;
import com.shanghaionstar.utils.AlertDialogUtil;

import java.util.concurrent.TimeUnit;

import rx.Observable;
import rx.Subscriber;
import rx.functions.Action1;

/**
 * Created by 6335yz on 2016/8/26.
 */
public class ShareNotAllowDialog extends Dialog {
    private String input;
    private String btnText;

    public ShareNotAllowDialog(Context context, String input, String btnText) {
        super(context,R.style.shareDialog);
        this.input = input;
        this.btnText = btnText;
    }

    public ShareNotAllowDialog(Context context, String input, String btnText, OnClickBtnListener onClickBtnListener) {
        super(context,R.style.shareDialog);
        this.input = input;
        this.btnText = btnText;
        this.onClickBtnListener = onClickBtnListener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.share_not_allow_dialog);
        TextView textView = (TextView) findViewById(R.id.content);
        Button i_know = (Button) findViewById(R.id.i_know);
        textView.setText(input);
        i_know.setText(btnText);
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        findViewById(R.id.i_know).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onClickBtnListener == null) {
                    dismiss();
                } else {
                    onClickBtnListener.onClickBtn();
                    dismiss();
                }
            }
        });
    }

    interface OnClickBtnListener {
        void onClickBtn();
    }

    OnClickBtnListener onClickBtnListener;

}
